package com.assist
{
	import flash.display.Stage;

	public class URI
	{
		public static var test:Boolean = false;
		private static var _stage :Stage;
		private static var _args:Object = new Object();
		private static var _clientUrl:String = "http://sxd.xdcdn.net/2012011401/";
		private static var _fullClientUrl:String;
		private static var _assetsUrl:String;
		private static var _domain:String = "4x001.xd.com";
		private static var _serverPort:int = 8000;
		
		public function URI()
		{
		}
		
		public static function analyze(main :Main) : void
		{
			_stage = main.stage;
			var index :Object = _stage.getChildAt(1);
			if (index.hasOwnProperty("args"))
			{
				_args = index.args;
			}
			if (_args["client_url"])
			{
				_clientUrl = _args["client_url"];
			}
			_assetsUrl = _clientUrl + "assets/";
			if (_clientUrl == "./")
			{
				_fullClientUrl = main.loaderInfo.url.replace(/(Main|rw)\.swf(\?[\s\S]+?)?/, "");
			}
			else
			{
				_fullClientUrl = _clientUrl;
			}
		}
		
		public static function get domain() : String
		{
			return _domain;
		}// end function
		
		public static function set domain(domain :String) : void
		{
			_domain = domain;
		}
		
		public static function get serverPort() : int
		{
			return _serverPort;
		}// end function
		
		public static function set serverPort(serverPort:int) : void
		{
			_serverPort = serverPort;
		}
		
		public static function get ip() : String
		{
			return _args["ip"] || "";
		}// end function
		
		public static function get port() : int
		{
			return _args["port"] || 0;
		}
		
		public static function get clientUrl() : String
		{
			return _clientUrl;
		}
		
		public static function get assetsRnd() : String
		{
			return _args["assets_rnd"] || "";
		}
		
		public static function formatVersion(str:String) : void {
			
		}
		
		public static function getVersion(resName:String) : String {
			return "";
		}
		
		public static function get assetsUrl() : String
		{
			return _assetsUrl;
		}
	}
}